# 提取CT和对应PET信息，存储为data.csv
import os
import pydicom

columns = ['patientID', 'z', 'x', 'y', 'r', 'cancer_type', 'CT_SeriesDescription',
           'PET_SeriesDescription', 'InstanceNumber', 'origin_dir', 'CT_origin_path', 'PET_origin_path',
           'CT_size', 'PET_size', 'CT_pixel_spacing', 'PET_pixel_spacing', 'patientWeight',
           'patientSex', 'patientAge', 'TotalDose', 't0', 't1', 'HalfLife', 'DecayFactor',
           'CT_slice_path', 'PET_slice_path', 'part_suvmax', 'global_suvmax', 'suv_avg',
           'suv_min', 'suv_std']

def extract_label_info():
    origin_path = 'D:/lung_cancer/data/old_data.csv'


def extract_CT_info():
    origin_path = 'D:\lung_cancer\data\origin_data'
    patientList = os.listdir(origin_path)
    for patient in patientList:

        CT_PATH = os.path.join(origin_path, patient, 'CT')
        CT_NAME = os.listdir(CT_PATH)
        CT_slice = pydicom.read_file(os.path.join(CT_PATH, CT_NAME[0]))


def extract_PET_info():
    origin_path = 'D:\lung_cancer\data\origin_data'
    patientList = os.listdir(origin_path)
    for patient in patientList:

        PET_PATH = os.path.join(origin_path, patient, 'PET')
        PET_NAME = os.listdir(PET_PATH)
        PET_slice = pydicom.read_file(os.path.join(PET_PATH, PET_NAME[0]))


if __name__ == '__main__':
    extract_label_info()